<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--
    Math对象的使用

-->

<script>

  var pi = Math.PI;
  console.log(pi)

  console.log("------------sqrt(4)---------------")
  var  num = 4
  var number = Math.sqrt(num);
  console.log(number)

  num = -2
  var number1 = Math.abs(num);
  console.log(number1)

  console.log("---------------随机数--------------------")
  // 随机数  [ 0 , 1)
  var number2 = Math.random()*10;
  console.log(Number.parseInt(number2))


  console.log("--------------向上取整---------------------")
  // 向上取整   获取大于当前值的最小整数
   num = 1.3
  console.log(Math.ceil(num))
  console.log("--------------向下取整---------------------")
  // 向下取整   获取小于当前值的最大整数
  console.log(Math.floor(num))

  console.log("--------------四舍五入---------------------")
  console.log(Math.round(num))

  console.log("--------------获取最大值---------------------")

  console.log(Math.max(1,2,3,4,5))

  console.log("--------------获取最小值---------------------")

  console.log(Math.min(1,2,3,4,5))

  console.log("--------------次幂操作---------------------")

  console.log(Math.pow(2,3))

</script>
</body>
</html>